package k2_oop.p9_collection.demo14;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class TeacherCourse {

    public static void main(String[] args) {

        HashMap<String,String> teacherCourse = new HashMap<>();


        teacherCourse.put("Tom","CoreJava");
        teacherCourse.put("John","Oracle");
        teacherCourse.put("Susan","Oracle");
        teacherCourse.put("Jerry","JDBC");
        teacherCourse.put("Jom","Unix");
        teacherCourse.put("Kevin","JSP");
        teacherCourse.put("Lucy","JSP");

        System.out.println(teacherCourse);

        teacherCourse.put("Allen","JDBC");

        teacherCourse.replace("Lucy","JSP","CoreJava");

        System.out.println(teacherCourse);

        Set<Map.Entry<String,String>> kv = teacherCourse.entrySet();

        kv.stream()
                .filter(entry->entry.getValue().equals("JSP"))
                .forEach(entry-> System.out.println(entry.getKey()+"===="+entry.getValue()));




    }

}
